package org.dtrd.modules.archive.entity.bean.report;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import org.dtrd.common.util.CheckUtil;
import org.dtrd.modules.archive.entity.po.DtrdEntRdArchivePhysical;
import org.dtrd.modules.util.SchemeUtil;

/**
 * <p>
 * 体格检查
 * </p>
 *
 * @author QR
 * @since 2022-01-23
 */
@Getter
@Setter
@ApiModel(value = "体格检查详情")
public class PhysicalReport {

    @ApiModelProperty("基础检查")
    private BasicCheck basicCheck;

    @ApiModel("基础检查")
    @Getter
    @Setter
    public static class BasicCheck {
        // 基础检查
        @ApiModelProperty("心率")
        private String heartRate="——";
        @ApiModelProperty("呼吸")
        private String breath="——";
        @ApiModelProperty("体温")
        private String temperature="——";
        @ApiModelProperty("体重")
        private String weight="——";
        @ApiModelProperty("身高")
        private String height="——";
        @ApiModelProperty("BMI")
        private String bmi="——";
        @ApiModelProperty("腰围")
        private String waist="——";
        @ApiModelProperty("臀围")
        private String hip="——";
        @ApiModelProperty("腰臀比")
        private String whratio="——";
        @ApiModelProperty("血压收缩压")
        private String bloodSystolicPress="——";
        @ApiModelProperty("血压舒张压")
        private String bloodDiastolicPress="——";
        @ApiModelProperty("左眼视力")
        private String vision="——";
        @ApiModelProperty("右眼视力")
        private String visionRight="——";
        @ApiModelProperty("脉搏")
        private String sphygmus;
        @ApiModelProperty("基础检查报告单")
        private String basicReportPhoto="";
    }


    @ApiModelProperty("皮肤检查")
    private SkinCheck skinCheck;

    @ApiModel("皮肤检查")
    @Getter
    @Setter
    public static class SkinCheck{
        // 皮肤检查
        @ApiModelProperty("皮肤检查")
        private String skinExam="——";
        @ApiModelProperty("皮肤症状")
        private String skinSymptom="——";
        @ApiModelProperty("胰岛素注射部位")
        private String insulinInjection="——";
        @ApiModelProperty("胰岛素注射部位症状")
        private String insulinInjectionSymptom="——";
        @ApiModelProperty("皮肤检查报告单")
        private String skinReportPhoto="";
    }


    @ApiModelProperty("眼底检查")
    private EyeCheck eyeCheck;

    @ApiModel("眼底检查")
    @Setter
    @Getter
    public static class EyeCheck {
        // 眼底检查
        @ApiModelProperty("微动脉瘤, 1-有,2-无")
        private String eyeMicroaneurysm="——";
        @ApiModelProperty("视网膜内出血, 1-有(任一象极中<20), 2-有(任一象极中>=20),3-无")
        private String eyeIntraretinalHemorrhage="——";
        @ApiModelProperty("棉絮斑, 1-有, 2-无")
        private String eyeCottonWoolSpots="——";
        @ApiModelProperty("眼底出血, 1-有, 2-无")
        private String eyeFundusBleeding="——";
        @ApiModelProperty("硬性渗出, 1-有(非后极区),2-有(后极区),3-无")
        private String eyeHardExudation="——";
        @ApiModelProperty("静脉串珠样改变, 1-有(<=两个象限),2-有(>两个象限),3-无")
        private String eyeVenousBeadedChanges="——";
        @ApiModelProperty("视网膜内微血管异常, 1-有(<=一个象限), 2-有(>一个象限), 3-无")
        private String eyeMicrovascularAbnormalitiesInRetina="——";
        @ApiModelProperty("后极部视网膜增厚, 1-有, 2-无")
        private String eyeThickeningPosteriorRetina="——";
        @ApiModelProperty("玻璃体积血, 1-有, 2-无")
        private String eyeVitreousHemorrhage="——";
        @ApiModelProperty("新生血管形成, 1-有, 2-无")
        private String eyeNeovascularization="——";
        @ApiModelProperty("视网膜前出血, 1-有, 2-无")
        private String eyePreretinalHemorrhage="——";
        @ApiModelProperty("眼底检查报告单")
        private String eyeReportPhoto="";
    }


    @ApiModelProperty("糖足检查")
    private FootCheck footCheck;

    @ApiModel("糖足检查")
    @Getter
    @Setter
    public static class FootCheck {
        // 糖足检查
        @ApiModelProperty("糖足检查, 1-异常, 2-无异常")
        private String footSugarFootInspection="——";
        @ApiModelProperty("足背动脉触诊, 1-正常, 2-减弱, 3-缺失")
        private String footPalpationOfDorsalisPedisArtery="——";
        @ApiModelProperty("踝反射, 1-正常, 2-减弱, 3-缺失, 4-亢进")
        private String footAnkleReflex="——";
        @ApiModelProperty("神经传导, 1-正常, 2-缺失")
        private String footNerveConduction="——";
        @ApiModelProperty("振动觉, 1-正常, 2-缺失")
        private String footVibrationSense="——";
        @ApiModelProperty("针刺痛觉, 1-正常, 2-缺失")
        private String footAcupuncturePain="——";
        @ApiModelProperty("温度觉, 1-正常, 2-缺失")
        private String footTemperatureSense="——";
        @ApiModelProperty("压力觉, 1-正常, 2-缺失")
        private String footPressureSense="——";
        @ApiModelProperty("足部检查报告单")
        private String footReportPhoto="";
    }

    @ApiModelProperty("其他检查")
    private OtherCheck other;

    @ApiModel("其他检查")
    @Getter
    @Setter
    public static class OtherCheck {
        // 其他检查
        @ApiModelProperty("间歇性跛行试验")
        private String claudicationTest="——";
        @ApiModelProperty("颈动脉听诊")
        private String carotidAuscultation="——";
        @ApiModelProperty("股动脉听诊")
        private String femoralAuscultation="——";
        @ApiModelProperty("下肢皮肤温度测定")
        private String legsSkinTemp="——";
        @ApiModelProperty("神经传导功能")
        private String nerveConduction="——";
        @ApiModelProperty("ABI")
        private String abi="——";
        @ApiModelProperty("ABI运动负荷试验")
        private String abiExerciseTest="——";
        @ApiModelProperty("TBI")
        private String tbi="——";
        @ApiModelProperty("经皮氧分压")
        private String tcPO2="——";
        @ApiModelProperty("其他检查报告单")
        private String otherReportPhoto="";
    }


    public PhysicalReport parseFromPO(DtrdEntRdArchivePhysical po) {
        if(CheckUtil.isNotNull(po.getHeartRate(), po.getSphygmus(), po.getBreath(), po.getTemperature(),
                po.getWeight(), po.getHeight(), po.getBmi(), po.getWaist(), po.getHip(), po.getWhratio(),
                po.getBloodSystolicPress(), po.getBloodDiastolicPress(), po.getVision(), po.getVisionRight())) {
            BasicCheck basicCheck = new BasicCheck();
            if (po.getHeartRate() != null) {
                basicCheck.setHeartRate(po.getHeartRate() + "次/分钟");
            }
            if (po.getBreath() != null) {
                basicCheck.setBreath(po.getBreath() + "次/分钟");
            }
            if (po.getTemperature() != null) {
                basicCheck.setTemperature(po.getTemperature() + "°C");
            }
            if (po.getWeight() != null) {
                basicCheck.setWeight(po.getWeight() + "kg");
            }
            if (po.getHeight() != null) {
                basicCheck.setHeight(po.getHeight() + "cm");
            }
            if (po.getBmi() != null) {
                basicCheck.setBmi(po.getBmi() + "");
            }
            if (po.getWaist() != null) {
                basicCheck.setWaist(po.getWaist() + "cm");
            }
            if (po.getHip() != null) {
                basicCheck.setHip(po.getHip() + "cm");
            }
            if (po.getWaist() != null && po.getHip() != null) {
                basicCheck.setWhratio(SchemeUtil.whratio(po.getWaist(), po.getHip()).toString());
            }
            if (po.getWhratio() != null) {
                basicCheck.setBloodSystolicPress(po.getBloodSystolicPress() + "mmHg");
            }
            if (po.getBloodDiastolicPress() != null) {
                basicCheck.setBloodDiastolicPress(po.getBloodDiastolicPress() + "mmHg");
            }
            if (po.getVision() != null) {
                basicCheck.setVision(po.getVision());
            }
            if (po.getVisionRight() != null) {
                basicCheck.setVisionRight(po.getVisionRight() + "");
            }
            if (po.getSphygmus() != null){
                basicCheck.setSphygmus(po.getSphygmus() + "");
            }
            this.setBasicCheck(basicCheck);
        }
        return this;
    }

}
